package cn.com.qtgl.userfilters.model.pojo;

import lombok.Getter;

import java.util.List;
import java.util.Objects;


@Getter
public class UserItem implements Triple{

    private final String code;

    public UserItem(String code) {
        this.code = code;
    }

    @Override
    public String getBody() {
        return "::"+this.code;
    }

    @Override
    public List<String> getItems() {
        return List.of(this.code);
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof UserItem userItem)) return false;
        return Objects.equals(getBody(), userItem.getBody());
    }

    @Override
    public int hashCode() {
        return Objects.hash(getBody());
    }

    @Override
    public String toString() {
        return getBody();
    }
}
